package com.xxx.control.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.xxx.control.R;

/**
 * Create by Sxl on 2023/7/19.
 */
public class UnitView extends LinearLayout {

    public UnitView(Context context) {
        this(context, null);
    }


    public UnitView(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public UnitView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context, attrs);
    }


    private void init(Context context, AttributeSet attrs) {
        LayoutInflater.from(getContext()).inflate(R.layout.view_unit, this, true);
        TypedArray t = context.obtainStyledAttributes(attrs, R.styleable.UnitView);
        String hint = t.getString(R.styleable.UnitView_hint);
        String tips = t.getString(R.styleable.UnitView_tips);
        t.recycle();
        ((EditText) findViewById(R.id.et_content)).setHint(hint);
        ((TextView) findViewById(R.id.tv_tips)).setText(tips);
    }
}
